/*
 * @Description:
 * @Author: r_yuesheng
 * @Date: 2022-03-30 16:31:00
 * @LastEditTime: 2022-03-30 17:29:54
 * @LastEditors: r_yuesheng
 */
import { createSlice } from '@reduxjs/toolkit';

const initialState = {
  value: 0
};

export const counterSlice = createSlice({
  name: 'counter',
  initialState,
  reducers: {
    add: state => {
      state.value += 1;
    },
    del: state => {
      state.value -= 1;
    }
  }
});

// Action creators are generated for each case reducer function
export const { add, del } = counterSlice.actions;

export default counterSlice.reducer;
